<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript">
    	$(document).ready(function(){
    		set_input_keydown_event();
    		$('#sex').combobox(); 
    		combobox_keypress('#sex','#address');   		
     		$('#save').click(function (){
     		  $('#sex_val').val($('#sex').combobox('getValue'));
    		  $('#mod_customer_form').form('submit', {
    		    url: 'modCustomer.action',error:function(message){
    		    	alert('提交数据错误，服务器可能已关闭！系统返回:'+message);
    		  	},
    		    success:function(data){
    		      var a = eval('(' + data + ')');
    		      $.messager.alert('修改客户', a.message, 'info',function(){
    		        if (a.result!='0') $('#name').focus();
    		      });
    		      
                  if (a.result=='0'){
                      var $tbl = $('#customer_table');
                      var row = $tbl.datagrid('getSelected');
                      var index = $tbl.datagrid('getRowIndex',row);
                      row.name=$('#name').val();
                      row.sexname=$('#sex').combobox('getText');
                      row.sex=$('#sex').combobox('getValue');
                      row.customerno = $('#customerno').val();
                      row.address = $('#address').val();
                      row.telephone = $('#telephone').val();
                      row.postcode = $('#postcode').val();
                      $tbl.datagrid('refreshRow', index);
                      
                      $('#mod_customer_detail_panel').window('close');
                  }
    		    }
    		    })
    		});

     		$('#cancel').click(function (){
     			$('#mod_customer_detail_panel').window('close');
    		});
  		    $('#mod_customer_detail_panel').window();
    	});
    </script>
	</head>
	<body>
	
    <div id="mod_customer_detail_panel" collapsible="false" fit="false" shadow="false"
    	title="修改客户" resizable="false" collapsible="false" minimizable="false" 
    	maximizable="false" closable="true" closed="true" icon="icon-save" 
    	modal="true" class="jquery_window">
    	<s:form id="mod_customer_form" action="modCustomer" cssStyle="margin:20px,50px">
    		<table>
    			<tr height="28px">
    				<td><s:label value="所属机构："></s:label></td>
    				<td><input id="deptno" style="width:200px"
			    		class="text_field_css" disabled="disabled"></input></td>
    			</tr>
    			<tr height="28px">
    				<td><s:label value="身份证号："></s:label></td>
    				<td><input id="identifyno" style="width:200px"
			    		class="text_field_css" disabled="disabled"></input>
			    		<s:hidden name="identifyno" 
    					id="identifyno_val"></s:hidden></td>
    			</tr>
    			<tr height="28px">
    				<td><s:label value="姓名：" for="name"></s:label></td>
    				<td><input id="name" name="name" 
    					maxlength=<s:property value="%{getText('NAME_LEN')}"/> 
    					style="width:150px" class="text_field_css"></input>
    					<label style="width:4px"></label>
			    		<label style="color:red">*</label>
			    		<label>必输项</label></td>
    			</tr>
			    <tr height="28px">
    				<td><s:label value="客户号：" for="customerno"></s:label></td>
			    	<td><input id="customerno" name="customerno" 
    					maxlength=<s:property value="%{getText('CUSTOMERNO_LEN')}"/>  
    					style="width:150px" class="text_field_css"></input>
    					<label style="width:4px"></label>
			    		<label style="color:red">*</label>
			    		<label>必输项</label></td>
			    </tr>
			    <tr height="28px">
    				<td><s:label value="性别：" for="sex"></s:label></td>
			 		<td><select id="sex" editable="false"
    					style="width:200px" panelHeight="auto">
    					<option value="1">男</option><option value="2">女</option>
    					</select><s:hidden id="sex_val" name="sex"/></td>
			    </tr>
    			<tr height="28px">
			    	<td><s:label value="住址：" for="address"></s:label></td>
    				<td><input id="address" name="address" 
    					maxlength=<s:property value="%{getText('ADDRESS_LEN')}"/>  
			    		style="width:250px" class="text_field_css"></input></td>
    			</tr>
    			<tr height="28px">
			    	<td><s:label value="电话：" for="telephone"></s:label></td>
    				<td><input id="telephone" name="telephone" 
    					maxlength=<s:property value="%{getText('TELEPHONE_LEN')}"/>  
			    		style="width:200px" class="text_field_css"></input></td>
    			</tr>
    			<tr height="28px">
			    	<td><s:label value="邮编：" for="postcode"></s:label></td>
    				<td><input id="postcode" name="postcode" 
    					maxlength=<s:property value="%{getText('POSTCODE_LEN')}"/>  
			    		style="width:200px" class="text_field_css"></input></td>
    			</tr>
    			<tr height="35px">
    				<td colspan="2" align="center">
            			<button id="save" class="buttons_css" style="width:70px">
            				<label style="70px" class="save_css">保存</label></button>
            			<label style="width:20px"></label>
            			<button id="cancel" class="buttons_css" style="width:70px">
            				<label style="70px" class="cancel_css">返回</label></button>
    				</td>
    			</tr>
    		</table>
    	</s:form>
    </div>
    </body>
</html>